//
//  ROHorizontalScrollListView.h
//  Runone
//
//  Created by runone02 on 16/12/1.
//  Copyright © 2016年 runone. All rights reserved.
//

#import <UIKit/UIKit.h>


/*
 * 配置文件
 */
@interface ListViewConfiguration : NSObject

@property (nonatomic, assign) BOOL hasSelectedAnimation;      //是否开启选中的动画

@property (nonatomic, strong) UIColor *labelTextColor;            //文本颜色

@property (nonatomic, strong) UIColor *labelSelectedColor;    //选中时文本的颜色

@property (nonatomic, strong) UIColor *lineColor;             // 线条颜色

@property (nonatomic, assign) CGFloat spacing;                //间距

@property (nonatomic, strong) UIFont *labelFont;              // 字体

@property (nonatomic, assign) CGFloat labelWidth;             //文本的宽度

@property (nonatomic, strong) UIScrollView *monitorScrollView;//被监听的scrollView

@property (nonatomic, assign) CGFloat monitorScrollViewWidth; //被监听的scrollView的宽度


+ (instancetype) defaultConfiguration;                        //创建默认的配置

@end


@interface ROHorizontalScrollListView : UIView {

    UIView  *_lineView;
    CALayer *_bottomLayer;
    
    NSMutableArray *_titleLabelArray;      // 标题的数组
    NSMutableArray *_titleLabelFrameCache; // 标题数组的宽度的缓存
}

@property (nonatomic, strong) NSArray *labelTextArray;                  //传入的标题数组

@property (nonatomic, weak, readonly) UILabel *currentSelectedLabel;    //当前选中的标签

@property (nonatomic, copy) void (^selectedAtIndex)(NSInteger integer); //选中的标签的回调

@property (nonatomic, assign) NSInteger currentIndex;                   //当前选中的标签的下标

/*
 *  初始化方法
 */

// 需提供相关设置
+ (instancetype) listViewWithFrame:(CGRect )frame TextArray:(NSArray *)textArray Configuration:(ListViewConfiguration *)configuration;
- (instancetype) initWithFrame:(CGRect)frame
                    TextArray:(NSArray *)textArray
                Configuration:(ListViewConfiguration *)configuration;


+ (instancetype) listViewWithFrame:(CGRect)frame TextArray:(NSArray *)textArray ;
- (instancetype) initWithFrame:(CGRect)frame TextArray:(NSArray *)textArray;

@end
